# coding=utf-8
from dbConnection.MysqlConn import Mysql
from app import redis

import sys
reload(sys)
sys.setdefaultencoding('utf8')


# 机器配置
def set_machine_conf():
    sql = "select machineId, machineNum, storeId FROM car_machine WHERE status = 1"
    mysql = Mysql()
    res = mysql.getAll(sql, None)
    mysql.dispose()
    if res:
        for d in res:
            maps = {}
            maps['machineId'] = d['machineId']
            maps['storeId'] = d['storeId']
            redis.hset('all_machine_conf', str(d['machineNum']), maps)